﻿@model IEnumerable<iDMS.Models.Sheet>
@using MvcHtmlHelpers
@{
    ViewBag.Title = "Drawing: " + ViewBag.Drawing.Identifier + " - Sheets";
}
<script type="text/javascript">
    $(function () {
        $("a.pol").button();

    });
</script>
<h3>
    Drawing: @ViewBag.Drawing.Identifier @ViewBag.Drawing.Name - <span class="accent">Sheets</span>
</h3>
<script type="text/javascript">
    $(function () {
        $("#CreateLink").button({
            icons: {
                primary: "ui-icon-plusthick"
            }
        })

    });
      
</script>
<table style="margin-top: 20px">
    <tr>
        <th>
        </th>
        <th>
        </th>
        @* <th>
            Drawing
        </th>*@
        <th>
            Page
        </th>
        <th>
            Revision
        </th>
        <th>
            Format
        </th>
        <th>
            Carrier
        </th>
        <th>
            DesignChange
        </th>
        <th>
            Innaplicable
        </th>
        <th>
            Status
        </th>
        <th>
            Date
        </th>
        <th>
        </th>
    </tr>
    @foreach (var item in Model)
    {
        
        <tr @if (item.UnderRevisionWithdrawal != null)
            { <text>class="lmagentabg"</text> }>
            <td>
                @Html.SheetDownloadActionLink(item)
            </td>
            <td>
                @Html.AttachmentListActionLink(item)
            </td>
            @*<td>
                @Html.DisplayFor(modelItem => item.Drawing.Identifier)
            </td>*@
            <td>
                @Html.DisplayFor(modelItem => item.PageNmb)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.RevisionSymbol)
            </td>
            <td title="@item.SheetFormat.FullName">
                @Html.DisplayFor(modelItem => item.SheetFormat.ShortName)
            </td>
            <td title="@item.InformationCarrier.Name">
                @Html.DisplayFor(modelItem => item.InformationCarrier.ShortName)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.DesignChange.Identifier)
                @Html.IconActionLink("Details", "DesignChange", new { id = item.DesignChangeID }, "", "ui-icon-search")
                @Html.DesignChangeDetailsActionLink(item.DesignChange)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.DesignChange1.Identifier)
                @if (item.InnaplicableChangeID.HasValue)
                {
                    @Html.IconActionLink("Details", "DesignChange", new { id = item.InnaplicableChangeID }, "", "ui-icon-search")
                }
                @Html.DesignChangeDetailsActionLink(item.DesignChange1)
            </td>
            <td title="@item.SheetLifeCycleStatuse.Description">
                @Html.DisplayFor(model => item.SheetLifeCycleStatuse.Name)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.CreateDate)
            </td>
            <td id="list">
                @if (item.LifeCycleStatusID == 1)
                {
                    @Html.ActionLink("Upload", "SheetUpload", new { id = item.ScheetID }, new { @class = "pol" })
                    @Html.ActionLink("Delete", "SheetDelete", new { id = item.ScheetID }, new { @class = "pol" })
                    
                }
                @if ((item.LifeCycleStatusID == 4 || item.LifeCycleStatusID == 6) && !item.UnderRevisionWithdrawal.HasValue)
                {
                    @Html.ActionLink("New Revision", "SheetReplace", new { id = item.ScheetID }, new { @class = "pol" })
                }
                @if ((item.LifeCycleStatusID == 4) && !item.UnderRevisionWithdrawal.HasValue)
                {
                    @Html.ActionLink("Withdrawn", "SheetWithdrawn", new { id = item.ScheetID }, new { @class = "pol" })
                }
            </td>
        </tr>
    }
</table>
<h5 style="margin-top: 15px">
    Legend:</h5>
<div style="display: inline-block; width: 15px; height: 15px;" class="lmagentabg">
</div>
<div style="display: inline-block; width: 300px; height: 20px;">
    - Sheet is under revision / withdrawal</div>
<p>
    @Html.ActionLink("Back to List", "Index", null, new { @class = "btl" })
    @Html.ActionLink("Add New Sheet", "SheetCreate", new { id = ViewBag.Drawing.DrawingID }, new { @id = "CreateLink" })
</p>
@Html.Partial("_AjaxDialog")
